package com.zitangkou.common.global;

import com.zitangkou.common.enums.RespEnum;
import lombok.Data;
import lombok.experimental.Accessors;

/**
 * 自定义异常类
 *
 * @author Deng Ningning
 * @version 1.0
 * @date 2020/8/14 17:32
 */
@Data
@Accessors(chain = true)
public class GlobalException extends RuntimeException {
    /**
     * 异常编号
     */
    private Integer code;
    /**
     * 异常信息
     */
    private String msg;

    public GlobalException() {
    }

    public GlobalException(RespEnum result) {
        this.code = result.getCode();
        this.msg = result.getMsg();
    }

    public GlobalException(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }
}
